/*
    created: 2023/4/18
    filename: treelist.h
    author: 李东霖
    purpose：二叉树的链式存储

*/

#ifndef _TREELIST_H_
#define _TREELIST_H_

#include<stdlib.h>
#include<stdio.h>
#include<string.h>

#define  MAXSIZE 100

typedef char ElemType;


typedef struct node
{
    ElemType data;
    struct node *lchild;
    struct node *rchild;
}BTNode,*BTree;


//采用括号表示法创建二叉树  返回值 -1-传入参数为空 0-成功
int CreateBTree(BTree* tree,char *str);
//销毁二叉树  没有置NULL 
void DestroyBTree(BTree* tree);
//查找结点 
BTNode* FindNode(BTree tree,ElemType *elem);
//查找该结点的子节点
BTNode* LchildNode(BTNode* Node);
BTNode* RchildNode(BTNode* Node);
//求这棵树的高度 
int TreeHight(BTree tree);
//输出二叉树,这是一个括号表示法    
void DispTree(BTree tree);

//层次遍历
void LevelOrder(BTree tree);
//先序遍历  
void PreOrder(BTree tree);
//中序遍历  
void InOrder(BTree tree);
//后序遍历  
void PostOrder(BTree tree);

#endif //!_TREELIST_H_